#ifndef AST_EXPRESSION_ASSIGNMENT_EXPR_H
#define AST_EXPRESSION_ASSIGNMENT_EXPR_H


#include "../ASTNode.h"

class ConditionalExpr;
class UnaryExpr;
class AssignmentOperator;

/*
C99 6.5.16
assignment-expression:
		conditional-expression
		unary-expression    assignment-operator    assignment-expression
*/
class AssignmentExpr : public ASTNode
{
protected:
	AssignmentExpr(void)
		: ASTNode(ASTNode::assignment_expression){};
public:
	AssignmentExpr(ConditionalExpr *pSingleExpr)
		: ASTNode(ASTNode::assignment_expression)
		, m_pCondExpr(pSingleExpr)
		, m_bIsConditionalExpr(true){};
	AssignmentExpr(UnaryExpr *pUnaryExpr, AssignmentOperator *pOp, AssignmentExpr *pAssignExpr)
		: ASTNode(ASTNode::assignment_expression)
		, m_pUnaryExpr(pUnaryExpr)
		, m_pAssignOp(pOp)
		, m_pAssignExpr(pAssignExpr)
		, m_bIsConditionalExpr(false){};


	virtual ~AssignmentExpr(void);


	virtual void					codeGen();

protected:
	bool					m_bIsConditionalExpr;
	union{
		ConditionalExpr *	m_pCondExpr;
		struct{
			UnaryExpr *		m_pUnaryExpr;
			AssignmentOperator *		m_pAssignOp;
			AssignmentExpr *	m_pAssignExpr;
		};
	};
};
#endif

